<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<!--

 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

--><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>log4cxx - Building Apache log4cxx with Microsoft Visual Studio</title>
    <style type="text/css" media="all">
      @import url("../css/maven-base.css");
      @import url("../css/maven-theme.css");
      @import url("../css/site.css");
    </style>
    <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                  <a href="http://logging.apache.org/" id="bannerLeft">
    
                                            <img src="../images/ls-logo.jpg" alt="" />
    
            </a>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2008-03-31
                          |   
                <a href="http://www.apache.org/" class="externalLink">Apache</a>
                &gt;
      
                <a href="http://logging.apache.org/" class="externalLink">Logging Services</a>
                &gt;
      
                <a href="../">log4cxx</a>
                          </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Get log4cxx</h5>
            <ul>
              
    <li class="none">
                    <a href="../download.html">Download</a>
          </li>
              
    <li class="none">
                    <a href="../changes-report.html">Changes</a>
          </li>
              
    <li class="none">
                    <a href="../license.html">License</a>
          </li>
          </ul>
              <h5>About log4cxx</h5>
            <ul>
              
    <li class="none">
                    <a href="../index.html">What is log4cxx?</a>
          </li>
              
    <li class="none">
                    <a href="../apidocs/index.html">API Documentation</a>
          </li>
              
    <li class="none">
                    <a href="../faq.html">FAQ</a>
          </li>
          </ul>
              <h5>Community</h5>
            <ul>
              
    <li class="none">
                    <a href="../mail-lists.html">Mailing Lists</a>
          </li>
              
    <li class="none">
                    <a href="../issue-tracking.html">Issue Tracking</a>
          </li>
              
    <li class="none">
                    <a href="http://wiki.apache.org/logging-log4cxx" class="externalLink">Wiki</a>
          </li>
          </ul>
              <h5>Development</h5>
            <ul>
              
    <li class="none">
                    <a href="../source-repository.html">Repository</a>
          </li>
              
          
              
      
            
      
            
      
            
            
            
      
              
            <li class="expanded">
                    <a href="../">Building</a>
                  <ul>
                  
    <li class="none">
                    <a href="../building/autotools.html">autotools</a>
          </li>
                  
    <li class="none">
                    <a href="../building/ant.html">Apache Ant</a>
          </li>
                  
    <li class="none">
                    <a href="../building/maven.html">Apache Maven 2</a>
          </li>
                  
    <li class="none">
              <strong>Microsoft Visual Studio</strong>
        </li>
                  
    <li class="none">
                    <a href="../building/xcode.html">Apple Xcode</a>
          </li>
              </ul>
        </li>
          </ul>
              <h5>Apache</h5>
            <ul>
              
    <li class="none">
                    <a href="http://www.apache.org" class="externalLink">Home</a>
          </li>
              
    <li class="none">
                    <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship</a>
          </li>
              
    <li class="none">
                    <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks</a>
          </li>
              
    <li class="none">
                    <a href="http://www.apachecon.com" class="externalLink">Conferences</a>
          </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="../images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Building Apache log4cxx with Microsoft Visual Studio</h2>
<div class="section"><h3>Preparation</h3>
<div class="source"><pre>unzip apr-1.2.11-win32-src.zip
rename apr-1.2.11 apr
unzip apr-util-1.2.10-win32-src.zip
rename apr-util-1.2.10 apr-util
cd apache-log4cxx-0.10.0
configure
configure-aprutil</pre>
</div>
<p>configure.bat copies the prefabricated log4cxx.hw and private/log4cxx_private.hw over to log4cxx.h and private/log4cxx_private.h.</p>
<p>configure-aprutil.bat uses &quot;sed&quot; to modify apu.hw and apr_ldap.hw to disable APR-Iconv and LDAP which are not necessary for log4cxx and problematic to build. If &quot;sed&quot; is not available, the modifications would be trivial to do in any text editor.</p>
<p>Use the Win32 source zips for APR and APR-Util to preserve the required line endings for the project files. Directories need to be renamed to &quot;apr&quot; and &quot;apr-util&quot; respectively.</p>
</div>
<div class="section"><h3>Building log4cxx.dll</h3>
<p>Open projects/log4cxx.dsw with Microsoft Visual Studio 6 or later at which time you may be prompted to upgrade the projects to the format used by your version of Microsoft Visual Studio.</p>
<p>Select log4cxx as active project and build.</p>
</div>
<div class="section"><h3>Running unit tests</h3>
<p>To pass the unit tests, gzip, zip and sed must be on the path. Also three environment variables need to be defined: TOTO=wonderful, key1=value1 and key2=value2. These must be done outside of Microsoft Visual Studio, either in the Control Panel or in a Command Prompt uses to launch Microsoft Visual Studio.</p>
<p>Open projects/testsuite.dsw or projects/testsuite-standalone.dsw (test suite and implementation in one project) in Microsoft Visual Studio, select active project and build.</p>
<p>On the Debug Tab of the Project/Settings dialog, set the Working Directory to &quot;../src/test/resources&quot;. Individual tests can be specified in Program Arguments and &quot;-v&quot; can be specified to output verbose test results.</p>
</div>
<div class="section"><h3>Known Issues</h3>
<ul><li>APR 1.2.12 has a known issue that will prevent compilation with Visual Studio 6 unless a later Platform SDK is installed. See APR bug <a href="http://issues.apache.org/bugzilla/show_bug.cgi?44327" class="externalLink">44327</a>
. APR 1.2.11 and the corresponding APR-Util 1.2.10 will compile with Visual Studio 6.</li>
<li>APR-Util requires later LDAP headers than provided with Visual Studio 6 and will fail to compile. log4cxx does not use LDAP, it can be disabled in apr_ldap.hw.</li>
<li>APR-Iconv is problematic and not used by log4cxx, it can be disabled in apu.hw.</li>
</ul>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2008
    
          Apache Software Foundation
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
